package com.bawei.module_main.viewholder

import android.animation.ObjectAnimator
import android.view.View
import android.widget.ImageView
import com.bawei.module_main.R
import com.bawei.module_main.bean.CustomBean
import com.zhpan.bannerview.holder.ViewHolder

/**
 * @Author : yaotianxue
 * @Time : On 2023/5/26 15:35
 * @Description : CustomPagerViewHolder
 */
class CustomPagerViewHolder:ViewHolder<CustomBean> {
    override fun getLayoutId(): Int {//f返回布局id
        return R.layout.main_guide_item
    }
    //绑定数据
    override fun onBind(itemView: View, data: CustomBean, position: Int, size: Int) {
        var imageView = itemView.findViewById<ImageView>(R.id.iv)
        imageView.setImageResource(data.res)
        //图片透明度动画
        var objectAnimator = ObjectAnimator.ofFloat(imageView, "alpha", 0f, 1f)
        objectAnimator.duration = 2000
        objectAnimator.start()
    }

}
